home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 1.toast / pc / sample code / graphics 2d / makeicon / initmac.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  2.1 KB  |  96 lines

  1. /*
  2.     File:        InitMac.c
  3.  
  4.     Contains:    
  5.  
  6.     Written by:     
  7.  
  8.     Copyright:    Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 7/9/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23. #include "InitMac.h"
  24. #include <GestaltEQU.h>
  25. #include <OSUtils.h>
  26. #include <Menus.h>
  27. #include <Fonts.h>
  28. #include <Quickdraw.h>
  29. #include <Windows.h>
  30. #include <Dialogs.h>
  31. #include <TextEdit.h>
  32. #include <Events.h>
  33.  
  34. SysEnvRec    TheWorld;
  35. Boolean        WNE_available;
  36. Boolean        HasGWorlds;
  37. Boolean        HasCQD;
  38.  
  39. #define    _Unimplemented 0xA89F
  40. #define    _WaitNextEvent 0xA860
  41.  
  42. Boolean TrapAvailable (short tNum,short tType)
  43. {
  44.     return ( NGetTrapAddress(tNum,tType) != NGetTrapAddress(_Unimplemented,kOSTrapType) );
  45. }
  46.  
  47. Boolean WNEIsImplemented()
  48. {
  49.     if (TheWorld.machineType < 0)
  50.     {
  51.         return false;
  52.     }
  53.     else
  54.     {
  55.         return TrapAvailable ( _WaitNextEvent, ToolTrap);
  56.     }
  57. }
  58.  
  59.  
  60. void CheckQuickDraw ()
  61. {
  62.     long      qdVersion;  /* Version of QuickDraw on this machine */
  63.     /* Find out if GWorlds and CQD are implemented on this machine */
  64.     (void) Gestalt (gestaltQuickdrawVersion, &qdVersion);
  65.  
  66.     HasGWorlds = (qdVersion > gestaltOriginalQD && qdVersion < gestalt8BitQD)
  67.                   || qdVersion >= gestalt32BitQD;
  68.     
  69.     HasCQD = qdVersion >= gestalt8BitQD;
  70.  
  71. }
  72.  
  73.  
  74. void InitToolBox(int numberOfMasters)
  75. {
  76.     
  77.     InitGraf(&qd.thePort);
  78.     InitFonts();
  79.     InitWindows();
  80.     InitMenus();
  81.     InitCursor();
  82.     TEInit();
  83.     FlushEvents(everyEvent, 0);
  84.     InitDialogs(nil);
  85.     
  86.     while(numberOfMasters--)
  87.         MoreMasters();
  88.         
  89.     MaxApplZone();
  90.     SysEnvirons(1,&TheWorld);
  91.     WNE_available = WNEIsImplemented();
  92.  
  93.     CheckQuickDraw ();
  94.  
  95. }
  96.